package com.lesso.yjy.sunflower.infra.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.lesso.yjy.sunflower.model.EmployeeDevice;
import com.lesso.yjy.sunflower.pojo.dto.EmployeeDeviceQueryDTO;
import com.lesso.yjy.sunflower.pojo.vo.EmployeeDeviceVO;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;

import java.util.List;

public interface EmployeeDeviceMapper extends BaseMapper<EmployeeDevice> {
    @Select("SELECT COUNT(1) FROM base_employee WHERE id = #{employeeId} AND del_status = 0")
    int checkEmployeeExists(Long employeeId);

    @Select("SELECT COUNT(1) FROM base_device WHERE device_code = #{deviceCode} AND del_status = 0")
    int checkDeviceExists(String deviceCode);

    List<EmployeeDeviceVO> selectPageList(RowBounds rowBounds, EmployeeDeviceQueryDTO dto);
}